package org.example.bean.enums;

/**
 * @author huangshen
 * @version 0.0.3
 * @description ExcelStyleEnum
 * @since 2021/12/21 14:55
 */
public enum ExcelStyleEnum {

    TITLE_BACKGROUND_COLOR(42,"title","color","标题单元格背景色"),

    CELL_BACKGROUND_COLOR(1,"cell","color","普通单元格背景色"),




    ;

    private int entry;

    private String cellType;

    private String dataType;

    private String desc;

    ExcelStyleEnum(int entry, String cellType, String dataType, String desc) {
        this.entry = entry;
        this.cellType = cellType;
        this.dataType = dataType;
        this.desc = desc;
    }

    /**
     * 根据值获取对应枚举对象
     * @param cellType 单元格类型 标题或者普通单元格
     * @param dataType 数据类型
     * @return
     */
    public static int getEnumEntryByType(String cellType,String dataType) {
        for (ExcelStyleEnum typeEnum : ExcelStyleEnum.values()) {
            if (cellType.equals(typeEnum.getCellType()) && dataType.equals(typeEnum.getDataType())) {
                return typeEnum.getEntry();
            }
        }
        return 0;
    }


    public int getEntry() {
        return entry;
    }

    public void setEntry(int entry) {
        this.entry = entry;
    }

    public String getCellType() {
        return cellType;
    }

    public void setCellType(String cellType) {
        this.cellType = cellType;
    }

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
